/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gob.inamhi.entidades;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author dhinojosa
 */
@Entity
@Table(name = "msen", schema="administrative")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Msen.findAll", query = "SELECT m FROM Msen m"),
    @NamedQuery(name = "Msen.findByMsenId", query = "SELECT m FROM Msen m WHERE m.msenId = :msenId"),
    @NamedQuery(name = "Msen.findByMsennomb", query = "SELECT m FROM Msen m WHERE m.msennomb = :msennomb"),
    @NamedQuery(name = "Msen.findByMsendesc", query = "SELECT m FROM Msen m WHERE m.msendesc = :msendesc"),
    @NamedQuery(name = "Msen.findByMsenuing", query = "SELECT m FROM Msen m WHERE m.msenuing = :msenuing"),
    @NamedQuery(name = "Msen.findByMsenfing", query = "SELECT m FROM Msen m WHERE m.msenfing = :msenfing"),
    @NamedQuery(name = "Msen.findByMsenumod", query = "SELECT m FROM Msen m WHERE m.msenumod = :msenumod"),
    @NamedQuery(name = "Msen.findByMsenfmod", query = "SELECT m FROM Msen m WHERE m.msenfmod = :msenfmod")})
public class Msen implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "msen__id")
    private Integer msenId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1000)
    @Column(name = "msennomb")
    private String msennomb;
    @Size(max = 1000)
    @Column(name = "msendesc")
    private String msendesc;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "msenuing")
    private String msenuing;
    @Basic(optional = false)
    @NotNull
    @Column(name = "msenfing")
    @Temporal(TemporalType.TIMESTAMP)
    private Date msenfing;
    @Size(max = 20)
    @Column(name = "msenumod")
    private String msenumod;
    @Column(name = "msenfmod")
    @Temporal(TemporalType.TIMESTAMP)
    private Date msenfmod;
    @JoinColumn(name = "marc__id", referencedColumnName = "marc__id")
    @ManyToOne
    private Marc marcId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "msenId")
    private Collection<Sens> sensCollection;

    public Msen() {
    }

    public Msen(Integer msenId) {
        this.msenId = msenId;
    }

    public Msen(Integer msenId, String msennomb, String msenuing, Date msenfing) {
        this.msenId = msenId;
        this.msennomb = msennomb;
        this.msenuing = msenuing;
        this.msenfing = msenfing;
    }

    public Integer getMsenId() {
        return msenId;
    }

    public void setMsenId(Integer msenId) {
        this.msenId = msenId;
    }

    public String getMsennomb() {
        return msennomb;
    }

    public void setMsennomb(String msennomb) {
        this.msennomb = msennomb;
    }

    public String getMsendesc() {
        return msendesc;
    }

    public void setMsendesc(String msendesc) {
        this.msendesc = msendesc;
    }

    public String getMsenuing() {
        return msenuing;
    }

    public void setMsenuing(String msenuing) {
        this.msenuing = msenuing;
    }

    public Date getMsenfing() {
        return msenfing;
    }

    public void setMsenfing(Date msenfing) {
        this.msenfing = msenfing;
    }

    public String getMsenumod() {
        return msenumod;
    }

    public void setMsenumod(String msenumod) {
        this.msenumod = msenumod;
    }

    public Date getMsenfmod() {
        return msenfmod;
    }

    public void setMsenfmod(Date msenfmod) {
        this.msenfmod = msenfmod;
    }

    public Marc getMarcId() {
        return marcId;
    }

    public void setMarcId(Marc marcId) {
        this.marcId = marcId;
    }

    @XmlTransient
    public Collection<Sens> getSensCollection() {
        return sensCollection;
    }

    public void setSensCollection(Collection<Sens> sensCollection) {
        this.sensCollection = sensCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (msenId != null ? msenId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Msen)) {
            return false;
        }
        Msen other = (Msen) object;
        if ((this.msenId == null && other.msenId != null) || (this.msenId != null && !this.msenId.equals(other.msenId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gob.inamhi.entidades.Msen[ msenId=" + msenId + " ]";
    }
    
}
